package com.cwz.api.factory;

import com.cwz.api.remote.RemoteSeataDemoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @program: w-demo
 * @description: seata demo 测试服务降级处理
 * @author: Wen
 **/
@Component
@Slf4j
public class RemoteSeataDemoFallbackFactory implements FallbackFactory<RemoteSeataDemoService> {
	@Override
	public RemoteSeataDemoService create(Throwable cause) {
		log.error("seata demo 测试服务调用失败:{}", cause.getMessage());
		return new RemoteSeataDemoService() {
			@Override
			public int updateNum(Long id) {
				return 0;
			}

			@Override
			public int updatePrice(Long id) {
				return 0;
			}

			@Override
			public int addSeataDemo() {
				return 0;
			}
		};
	}
}
